#define _CRT_SECURE_NO_WARNINGS 1
int dominantIndex(int* nums, int numsSize) {
    int max = 0;
    int mid = 0;
    int count = 0;
    int i = 0;
    for (i = 0; i < numsSize; i++)
    {
        if (nums[i] > max)
        {
            mid = max;
            max = nums[i];
            count = i;
        }
        else if (nums[i] > mid)
        {
            mid = nums[i];
        }


    }
    return max >= 2 * mid ? count : -1;
}